package com.youth.youthservice.controller;


import com.youth.commonutils.R;
import com.youth.youthservice.service.CourseMemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author huangqicai
 * @since 2023-04-24
 */
@RestController
@RequestMapping("/eduservice/coursemember")
@Api(value = "课程成员表")
public class CourseMemberController {

    @Autowired
    private CourseMemberService courseMemberService;

    @ApiOperation(value = "向课程成员表里面添加信息,用于远程调用")
    @GetMapping("/insertCourseMember/{courseId}/{memberId}")
    public boolean insertCourseMember(@PathVariable(value = "courseId") String courseId,
                                      @PathVariable(value = "memberId") String memberId){
        return courseMemberService.insertCourseMember(courseId,memberId);
    }

    @ApiOperation(value = "根据课程id和用户id判断该用户是否具有操作权限")
    @GetMapping("/selectAuthority/{courseId}/{memberId}")
    public R selectAuthority(@PathVariable(value = "courseId") String courseId,
                             @PathVariable(value = "memberId") String memberId){

        return courseMemberService.selectAuthority(courseId,memberId);

    }

}

